package com.flca.pstc42.dto;

import org.garret.perst.Persistent;

public class StreetDto extends Persistent {

	int streetId;
	int cityId;
	String street;
	
	
	public StreetDto() {
		super();
	}
	
	public StreetDto(int streetId, int cityId, String street) 
	{
		super();
		this.streetId = streetId;
		this.cityId = cityId;
		this.street = street;
	}


	public int getStreetId() {
		return streetId;
	}
	public void setStreetId(int streetId) {
		this.streetId = streetId;
	}
	public int getCityId() {
		return cityId;
	}
	public void setCityId(int cityId) {
		this.cityId = cityId;
	}
	public String getStreet() {
		return street;
	}
	public void setStreet(String street) {
		this.street = street;
	}

	public String getData() 
	{
		return "" + getCityId() + ";" + getStreet();
	}
	
	public static StreetDto make(String aCsvLine)
	{
		StreetDto result = new StreetDto();
		
		String tokens[] = aCsvLine.split(";");
		
		result.setStreetId(Integer.parseInt(tokens[0]));
		result.setCityId(Integer.parseInt(tokens[1]));
		result.setStreet(tokens[2]);
		
		return result;
	}
	
}
